package com.xc.erp.modules.erp.controller.oss;

import com.xc.erp.common.annotation.Log;
import com.xc.erp.modules.erp.domain.AjaxResult;
import com.xc.erp.modules.erp.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件上传OSS
 *
 * @author wjw 2022/12/14
 * @DateTime: 2022/12/14 15:20
 */
@Api(tags = "OSSApi接口")
@RestController
@RequestMapping("/oss")
public class OssController {


    @Autowired
    private FileService fileService;

    @Log(modul = "上传",desc = "上传图片、文件")
    @ApiOperation("上传接口")
    @PostMapping("fileUpload")
    public AjaxResult fileUpload(MultipartFile file){
        String url = fileService.upload(file);
        return AjaxResult.success(url);
    }

}
